<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>首页</title>
    <base href="<%=basePath%>">


    <style type="text/css">
      #maindiv{
        margin: 0 auto;
        width: 300px;
        text-align:center;
        border:2px solid #a1a1a1;
        padding:10px 40px;
        background:#dddddd;
        border-radius:25px;
        -moz-border-radius:25px; /* 老的 Firefox */
      }

    </style>
    <script src="<%=basePath%>plug_in/js/jquery-1.11.1.min.js"></script>

  </head>
  <body>

  <h3>修改页面</h3>

  <a style="cursor: pointer;" href="<%=basePath%>api/test/list" >返回</a>

  <input type="button" value="保存" onclick="saveOpt()" />
  <form id="zzyForm" >

    <!-- 隐藏属性 -->
   <input id="load"  type="hidden" name="load" value="${load}" />


    <table border="1" width="90%">
    <tr align="center">
      <td>id</td>
      <td><input id="id" name="id" readonly="readonly" value="${model.id}" /></td>
    </tr>
    <tr align="center">
      <td>title</td>
      <td><input id="title" name="title" value="${model.title}"  /></td>
    </tr>
    <tr align="center">
      <td>name</td>
      <td><input id="name" name="name" value="${model.name}"  /></td>
    </tr>
    <tr align="center">
      <td>num</td>
      <td><input id="num" type="number" name="num"  value="${model.num}"  /></td>
    </tr>
  </table>

  </form>

  </body>


  <script>

    function saveOpt() {
        $.ajax({
            url:"<%=basePath%>api/test/opt",
            type:"POST",
            cache:false,
            async:false,
            data:$("#zzyForm").serialize(),
            dataType:"json",
            success:function(data){
                alert("保存成功!");
                location.href='<%=basePath%>api/test/list';
            },
            error:function(data){
                alert("系统异常!")
            }
        });
    }


  </script>
</html>
